import React from 'react'
import { Outlet, useNavigate } from 'react-router-dom'

export default function Home() {

  const navigate = useNavigate();
   /* 
  navigate方法：
    - 参数1：是to的地址
    - 参数2：配置对象，可以写一个state属性，就是state传参
  
  */

  const toMusicHandle = () => {
    navigate("/main/home/music/?user=二狗子&id=001")
  }

  const toNewsHandle = () => {
    navigate("/main/home/news/?user=翠花&id=001")
  }
  return (
    <div>
      <h3>我是Home的内容</h3>
      <button onClick={toMusicHandle}>Music</button>
      <button onClick={toNewsHandle}>News</button>
      <Outlet />
    </div>
  )
}
